import type * as T from './type'
import http from '@/utils/http'
import type {CustomerDto, CustomerQuery} from "./type";
import type {LabelValueState} from "@/types/global";
// @ts-ignore
export type * from './type'
const BASE_URL = '/business/customer'
/** @desc 查询用户列表 */
export function listCustomer(query: T.CustomerQuery) {
  return http.get<PageRes<T.CustomerPageQuery[]>>(`${BASE_URL}/page`, query)
}

export function unActivityPage(query: T.CustomerQuery) {
  return http.get<PageRes<T.CustomerPageQuery[]>>(`${BASE_URL}/unActivityPage`, query)
}



/** @desc 根下拉框選擇加盟商集合 */
export function getSelectCustomers() {
  return http.get<LabelValueState[]>(`${BASE_URL}/getSelectCustomerList`)
}


/** @desc 根據單元編號查询用户集合 */
export function getByUnitIdCustomers(query: any) {
  return http.get<CustomerDto[]>(`${BASE_URL}/list`,query)
}

/** @desc 查询用户详情 */
export function getCustomer(id: any) {
  return http.get<T.CustomerDto>(`${BASE_URL}/getData/${id}`)
}

/** @desc 新增用户 */
export function addCustomer(data: any) {
  return http.post(`${BASE_URL}/batchCreate`, data)
}

/** @desc 修改用户 */
export function updateCustomer(data: any) {
  return http.post(`${BASE_URL}/modify`, data)
}

/** @desc 删除用户 */
export function deleteCustomer(ids: string | Array<string>) {
  return http.del(`${BASE_URL}/delete/${ids}`)
}


/** @desc 重置密码 */
export function resetPwd(data: any) {
  return http.post(`${BASE_URL}/resetPwd`, data)
}

/** @desc 修改用戶狀態 */
export function updateStatus(query: {customerId: any; status: any}) {
  return http.post(`${BASE_URL}/updateStatus`, query)
}


/** @desc 导出用户 */
export function exportCustomer(query:T.CustomerQuery) {
  return http.download(`${BASE_URL}/exportCustomer`, query)
}

/** @desc 导出用户 */
export function exportUnActivityCustomer(query:T.CustomerQuery) {
  return http.download(`${BASE_URL}/exportUnActivityCustomer`, query)
}



